package cn.tedu.tw.lsw.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class AppJdbcSelect {

    public static void main(String[] args)throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost:3306/test?useSSL=false";
        String username="root";
        String password="root";
        Connection connection=DriverManager.getConnection(url,username,password);
        Statement statement=connection.createStatement();
        String sql="SELECT * FROM `user` ORDER BY id";
        ResultSet set =statement.executeQuery(sql);
        while (set.next()){
            String v= set.getString(2);
            long g= set.getLong(1);
            System.out.println("id is:"+g+","+"username is:"+v);
        }
    }
}
